//
//  OnlineOLDetailTableViewCell.m
//  ShangHaiHuDongApp
//
//  Created by apple on 17/9/4.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "OnlineOLDetailTableViewCell.h"

@implementation OnlineOLDetailTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initMyCell];
    }
    return self;
}

-(void)initMyCell{
    [self.contentView addSubview:self.ybTitleLabel];
    [self.contentView addSubview:self.ybContentLabel];
    [self.contentView addSubview:self.ybTimeLabel];
    UIImageView * timeLogoImageView = [[UIImageView alloc]initWithFrame:CGRectMake(1, 1, 1, 1)];
    timeLogoImageView.image = [UIImage imageNamed:@"hdxq_time"];
    [self.contentView addSubview:timeLogoImageView];
    
    self.ybTitleLabel.sd_layout.leftSpaceToView(self.contentView , ItemWidth * 24).topSpaceToView(self.contentView , ItemHeight * 24).widthIs(1).heightIs(1);
    
    self.ybContentLabel.sd_layout.leftSpaceToView(self.contentView , ItemWidth * 24).topSpaceToView(self.ybTitleLabel , ItemHeight * 31).widthIs(1).heightIs(1);
    
    timeLogoImageView.sd_layout.leftSpaceToView(self.contentView , ItemWidth * 26).bottomSpaceToView(self.contentView , ItemHeight * 38).widthIs(ItemWidth * 24).heightIs(ItemWidth * 24);
    
    self.ybTimeLabel.sd_layout.leftSpaceToView(timeLogoImageView , ItemWidth * 17).bottomSpaceToView(self.contentView , ItemHeight * 30).widthIs([UIScreen zj_screenWith] * 0.5).heightIs(ItemWidth * 40);
}



-(void)setModel:(OnlineOLDetailModel *)model
{
    _model = model;
    self.ybTitleLabel.sd_layout.leftSpaceToView(self.contentView , ItemWidth * 24).topSpaceToView(self.contentView , ItemHeight * 24).widthIs(model.titleSize.width).heightIs(model.titleSize.height);
    [self.ybTitleLabel updateLayout];
    self.ybTitleLabel.attributedText = model.titleAttributeString;
    
    self.ybContentLabel.sd_layout.leftSpaceToView(self.contentView , ItemWidth * 24).topSpaceToView(self.ybTitleLabel , ItemHeight * 31).widthIs(model.contentSize.width + 1).heightIs(model.contentSize.height);
    [self.ybContentLabel updateLayout];
    self.ybContentLabel.attributedText = model.contentAttributeString;
    
    self.ybTimeLabel.text = [NSString stringWithFormat:@"%@" , model.START_TIME];
}


-(UILabel *)ybTitleLabel
{
    if (!_ybTitleLabel) {
        _ybTitleLabel = [ToolClass creatLabelWithFrame:CGRectMake(1, 1, 1, 1) font:16 textColor:[UIColor textBlackColor] text:@""];
    }
    return _ybTitleLabel;
}

-(UILabel *)ybContentLabel
{
    if (!_ybContentLabel) {
        _ybContentLabel = [ToolClass creatLabelWithFrame:CGRectMake(1, 1, 1, 1) font:16 textColor:[UIColor textGrayColor] text:@""];
    }
    return _ybContentLabel;
}

-(UILabel *)ybTimeLabel
{
    if (!_ybTimeLabel) {
        _ybTimeLabel = [ToolClass creatLabelWithFrame:CGRectMake(1, 1, 1, 1) font:14 textColor:[UIColor zj_colorWithHexString:@"a8a8a8"] text:@""];
    }
    return _ybTimeLabel;
}

@end
